package com.fangzhi.controller;

import com.fangzhi.mobel.RoleBaseInfo;
import com.fangzhi.mobel.vo.RoleListVo;
import com.fangzhi.service.RoleBaseInfoService;
import com.fangzhi.utils.ResponseResult;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/role")
@RestController
public class RoleController {

    @Autowired
    private RoleBaseInfoService roleBaseInfoService;

    /**
     * 根据权限获取所有可选择的权限
     * @return
     */
    @GetMapping("/roleList")
    public ResponseResult roleList(@RequestParam(defaultValue = "0") Integer roleId){
        List<RoleListVo> voList = roleBaseInfoService.roleList(roleId);
        return ResponseResult.OK(voList);
    }
}
